package org.wendu.wdoa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.wendu.wdoa.common.Department;
import org.wendu.wdoa.dto.InfoDto;
import org.wendu.wdoa.model.EmpUser;

import java.util.List;

public interface InfoDao {


    List<EmpUser> getEmpList(InfoDto dto);

    @Insert("insert t_emp set e_id=#{e_id},d_id=#{d_id}, e_name=#{e_name},e_sex=#{e_sex},e_birth=#{e_birth};")
    void addUser(EmpUser empUser);

    @Delete("delete from t_emp where e_id=#{e_id}")
    void deleteUser(Integer id);

    @Select("select count(1) from t_emp where e_id=#{e_id}")
    int findUserById(Integer id);

    @Update("update t_emp set d_id=#{id} where e_id=#{userId}")
    void updateUser(Integer id,Integer userId);

    @Select("select d_id,d_name from t_dep")
    List<Department> findDep();
}
